<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="author" content="逯灿灿">
    <title>遮罩层</title>
    <style>
    *{
        box-sizing: border-box;
    }
    body{
        margin: 0;
    }
    .box{
        width: 500px;
        height: 800px;
        margin: 0px auto;
        background-color: #dcdcdc;
    }
    .top{
        width: 350px;
        height: 450px;
        margin: 0px auto;
        top: 20px; 
        position: relative; 
        background-color: white;
    }
    .top img{
        width: 350px;
        height: 450px;
    }
    .topShow{
        width: 350px;
        height: 450px;
        position: absolute;
        top: 0;
        border: 6px solid orange;
        display: none; 
    }
    .foot{
        width: 350px;
        height: 200px;
        background-color: white;  
        margin: 40px auto;
    }
    .foot .list{
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .foot .list li {
        width: 150px;
        height: 180px;
        margin: 10px;
        position: relative;
        left: 5px;
    }
    .foot .list li img{
        width: 150px;
        height: 180px;
    }
    .list .listShow{
        width: 150px;
        height: 180px;
        background-color: rgba(0, 0, 0, 0.5);
        position: absolute;
        top: 0;
        overflow: hidden;
        opacity: 0;
    }
    p{
        width: 150px;
        color: white;
        font-size: 25px;
        position: absolute;
        left: -150px;
    }
    
    </style>
</head>

<body>
    <div class="box">
        <div class="top">
            <img src="./img/1.png" alt="">
            <div class="topShow"></div>
        </div>
        <div class="foot">
            <ul class="list">
                <li><img src="./img/2.png" alt="">
                    <div class="listShow">
                        <p>我是项链我是项链</p>
                    </div>
                </li>
                <li><img src="./img/3.png" alt="">
                    <div class="listShow">
                        <p>我是潮牌我是潮牌</p>
                    </div>
                </li>
            </ul>
        </div>
    </div>


    <script src="./js/jquery.js"></script>
</body>

</html>
<script>
    $('.top').hover(function(){
        $('.topShow').fadeTo(300,1);
    },function(){
        $('.topShow').fadeTo(300,0);
    })
    $('.list li').hover(function(){
        console.log($(this).index());
        $('.listShow').eq($(this).index()).clearQueue().fadeTo(300,1);
        $('p').eq($(this).index()).clearQueue().animate({left:0},200);
    },function(){
         $('p').eq($(this).index()).clearQueue().animate({left:-150},200);
        $('.listShow').eq($(this).index()).clearQueue().fadeTo(300,0);
    });

</script>